<?php

class equipmentModel extends Model{
    public function selectequipment(){
        $sql = "select * from accouter";
        return $this->link->selectByAll($sql);
    }

    public function deleteequipment($equipmentid){
        $sql = "delete from accouter where id=$equipmentid";
        return $this->link->delete($sql);
    }

    public function addequipment($equipment_equipment, $equipment_name, $equipment_price, $equipment_property){
        $sql = "INSERT INTO accouter (image,equipment,price,property) VALUES ('$equipment_equipment','$equipment_name','$equipment_price','$equipment_property')";
        return $this->link->insert($sql);
    }
    public function modifyequipmentimg($modify_equipment,$modify_name,$modify_price,$modify_property,$equipment_id){
        $sql = "UPDATE accouter SET image = '$modify_equipment',`equipment`='$modify_name',price='$modify_price',property='$modify_property' WHERE id ='$equipment_id'";
        return $this->link->update($sql);
    }
	public function modifyequipment($modify_name,$modify_price,$modify_property,$equipment_id){
        $sql = "UPDATE accouter SET `equipment`='$modify_name',price='$modify_price',property='$modify_property' WHERE id ='$equipment_id'";
        return $this->link->update($sql);
    }


    public function searchequipment($equipment_text){
        $sql = "select * from accouter where `equipment` like '%{$equipment_text}%' or `property` like '%{$equipment_text}%'";
        return $this->link->selectByAll($sql);
    }
}